/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ca.trader.utils;

import ca.trader.regions.Country;
import ca.trader.regions.RegionManager;
import ca.trader.sale.SaleCategoryEnum;
import ca.trader.startup.ServletContextManager;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Ahsan
 */
public class UIUtils
{

	 public static boolean wasUserAuthenticationSuccess(HttpSession session)
	 {
		  return HttpUtils.wasUserAuthenticationSuccess(session);
	 }

	 public static boolean wasUserAuthenticationFailed(HttpSession session)
	 {
		  return HttpUtils.wasUserAuthenticationFailed(session);
	 }

	 public static String getUserNotAuthenticatedEmail(HttpSession session)
	 {
		  if (session.getAttribute(HttpConsts.SESSION_ATTRIBUTE_USER_NOT_AUTHENTICATED_EMAIL) == null)
		  {
			   return "";
		  }

		  return session.getAttribute(HttpConsts.SESSION_ATTRIBUTE_USER_NOT_AUTHENTICATED_EMAIL).toString().trim();
	 }

	 public static Country[] getCountryList()
	 {
		  RegionManager regionManager = ServletContextManager.getRegionManager();

		  return regionManager.getCountryList();
	 }

	 public static SaleCategoryEnum[] getCategoryList()
	 {
		  return SaleCategoryEnum.values();
	 }

}
